﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using YFIN.Admin.ViewModels.Admin;
using YFIN.Admin.ProductServiceRef;

namespace YFIN.Admin.Admin
{
    public partial class ProductManage : UserControl
    {
        ProductManageVM _pmvm;
        public ProductManage()
        {
            InitializeComponent();
            _pmvm = new ProductManageVM();
            this.DataContext = _pmvm;
        }
        private void edit_Click(object sender, RoutedEventArgs e)
        {
            _pmvm.Update(((Button)sender).DataContext);
        }
        private void delete_Click(object sender, RoutedEventArgs e)
        {
            _pmvm.Product = ((Button)sender).DataContext as ModelProduct;
            _pmvm.Delete();
        }
    }
}
